package com.example.job;

import org.quartz.Job;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public abstract class BaseJob implements Job {
    
    protected final Logger logger = LoggerFactory.getLogger(getClass());

    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        JobDataMap jobDataMap = context.getMergedJobDataMap();
        String jobData = jobDataMap.getString("jobData");
        
        if (jobData != null && !jobData.isEmpty()) {
            logger.info("Job自定义参数: {}", jobData);
        }
        
        doExecute(context);
    }

    protected abstract void doExecute(JobExecutionContext context) throws JobExecutionException;
}